/**
 * 
 */
package run;

/**
 * @author ys
 * 
 */
public class SearchCondition {
	public String commodityName;
	public String smallClass;
	public String mainClass;
	public String lowerPrice;
	public String upperPrice;

	/**
	 * @param commodityName
	 * @param smallClass
	 * @param mainClass
	 * @param lowerPrice
	 * @param upperPrice
	 */
	public SearchCondition(String commodityName, String smallClass,
			String mainClass, String lowerPrice, String upperPrice) {
		super();
		this.commodityName = commodityName;
		this.smallClass = smallClass;
		this.mainClass = mainClass;
		this.lowerPrice = lowerPrice;
		this.upperPrice = upperPrice;
	}

	/**
	 * @return the commodityName
	 */
	public String getCommodityName() {
		return commodityName;
	}

	/**
	 * @param commodityName
	 *            the commodityName to set
	 */
	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	/**
	 * @return the smallClass
	 */
	public String getSmallClass() {
		return smallClass;
	}

	/**
	 * @param smallClass
	 *            the smallClass to set
	 */
	public void setSmallClass(String smallClass) {
		this.smallClass = smallClass;
	}

	/**
	 * @return the mainClass
	 */
	public String getMainClass() {
		return mainClass;
	}

	/**
	 * @param mainClass
	 *            the mainClass to set
	 */
	public void setMainClass(String mainClass) {
		this.mainClass = mainClass;
	}

	/**
	 * @return the lowerPrice
	 */
	public String getLowerPrice() {
		return lowerPrice;
	}

	/**
	 * @param lowerPrice
	 *            the lowerPrice to set
	 */
	public void setLowerPrice(String lowerPrice) {
		this.lowerPrice = lowerPrice;
	}

	/**
	 * @return the upperPrice
	 */
	public String getUpperPrice() {
		return upperPrice;
	}

	/**
	 * @param upperPrice
	 *            the upperPrice to set
	 */
	public void setUpperPrice(String upperPrice) {
		this.upperPrice = upperPrice;
	}

	public void renewCondition(SearchCondition oldCondition) {
		if (commodityName == null && mainClass == null) {
			if (commodityName == null) {
				commodityName = oldCondition.commodityName;
			}
			if (mainClass == null) {
				mainClass = oldCondition.mainClass;
			}
			if (smallClass == null) {
				smallClass = oldCondition.smallClass;
			}
			if (lowerPrice == null) {
				lowerPrice = oldCondition.lowerPrice;
			}
			if (upperPrice == null) {
				upperPrice = oldCondition.upperPrice;
			}
		}
	}

}
